// levelmarker.h: interface for the Marker class.
//
//////////////////////////////////////////////////////////////////////

#ifndef LEVELMARKER_H
#define LEVELMARKER_H

#include <QWidget>
#include <QPainter>

class Plot;

class LevelMarker : public QObject
{
	Q_OBJECT

public:
	LevelMarker(Plot* plot, QObject* parent = 0);

	void setPlot(Plot* newPlot);
    void setArea(const QRect& r);
    void setRange(double minValue, double maxValue);

    void moveToPoint(const QPoint& p);
    void update();
    double getLevel();

	void setName(const QString& newName);
	QString	getName();

	Plot* getPlot();

    void setColor(QColor color);
	QColor getColor();

	void setFont(QFont font);
	QFont getFont();

    void draw(QPainter &p);
    bool contains(const QPoint& point);

private:
    double      calcLevel();
	QColor		mColor;
	QString		mName;
    QRect		mHandleAreaLeft;
    QRect       mHandleAreaRight;
	QPoint		mCenterPoint;
    double      mLevel;
    int         mAreaHeight;

	/* The plot this marker is associated with */
	Plot*		mPlot;
	
	QFont mFont;
};

#endif
